﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace IGIS
{
    public class ErrorLog
    {
        private string mConnectionString;
        private string commandText = @"INSERT INTO ErrorLog(ErrorType, ErrorMessage, ErrorStack) VALUES(@ErrorType, @ErrorMessage, @ErrorStack)";

        public ErrorLog(string connectionString)
        {
            mConnectionString = connectionString;
        }

        public int AddError(Exception e)
        {
            //SqlConnection connection = new SqlConnection(mConnectionString);
            //SqlCommand command = new SqlCommand();
            //command.Connection = connection;
            //command.CommandText = commandText;
            //command.Parameters.Add(new SqlParameter("ErrorType", e.GetType().FullName));
            //command.Parameters.Add(new SqlParameter("ErrorMessage", e.Message));
            //command.Parameters.Add(new SqlParameter("ErrorStack", e.StackTrace));
            //int i = 0;
            //try
            //{
            //    connection.Open();
            //    i = command.ExecuteNonQuery();
            //    connection.Close();
            //}
            //catch (Exception) { }
            return 1;
        }
    }
}